/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tabelamodelcolumnmodel.empresa;

import tabelamodelcolumnmodel.fornecedor.*;
import eloma.classe.Fornecedor;
import eloma.classe.empresa.Telefone;
import java.util.List;
import javax.swing.JFormattedTextField;
import javax.swing.table.AbstractTableModel;
import javax.swing.text.MaskFormatter;

/**
 *
 * @author Icaro
 */
public class EmpresaTableModel extends AbstractTableModel {

    private List<Telefone> listTelefone;
    private boolean ordenarPorNome = true;

    public EmpresaTableModel(List<Telefone> listTelefone) {
        this.listTelefone = listTelefone;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Telefone telefone = listTelefone.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return telefone.getTelefone();
        }

        return null;
    }

    @Override
    public int getRowCount() {
        return listTelefone.size();
    }

    @Override
    public int getColumnCount() {
        return 2;
    }

    public Telefone getValoresTelefone(int rowIndex) {
        return listTelefone.get(rowIndex);
    }

    public boolean isOrdenarPorNome() {
        return ordenarPorNome;
    }

    public void setOrdenarPorNome(boolean ordenarPorNome) {
        this.ordenarPorNome = ordenarPorNome;
    }
}
